//Source file: D:\\Users\\afpa\\Documents\\workspace\\20-otarie\\src\\fr.afpa.biblio.dao\\AdherentsDao.java

package fr.afpa.biblio.dao;

import java.text.ParseException;
import java.text.SimpleDateFormat;

import fr.afpa.biblio.metier.Adherent;
import fr.afpa.biblio.metier.BiblioExeception;
import fr.afpa.biblio.metier.Exemplaire;

public class AdherentsDao {
	private fr.afpa.biblio.metier.Adherent[] adherentDB;
	
	
	
	
	/**
	 * @roseuid 5240E3CF0093
	 */
	public AdherentsDao() {
		Adherent adh1 = null;
		SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");

		try {
			 adh1 = new Adherent("Fred", "Jonathan",
					sdf.parse("20/09/1986"), "masculin", 123456, "marseille",
					"Toto", null, "0165487896");
		} catch (BiblioExeception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (InstantiationException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IllegalAccessException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (ParseException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		adherentDB=new Adherent[1];
		adherentDB[0]=adh1;
		
		
	}

	
	
	
	
	/**
	 * @param id
	 * @return fr.afpa.biblio.metier.Adherent
	 * @roseuid 5240D5AB019C
	 */
	public fr.afpa.biblio.metier.Adherent findByKey(int id) {
		for (Adherent e : adherentDB) {
			if (e.getIdUtilisateur() == id) {
				return e;
			}

		}
		
		
		return null;
	}
}
